/*
 * Copyright:  2018 smarabbit studio.
 *
 *  Licensed under the Confluent Community License; you may not use this file
 *  except in compliance with the License.  You may obtain a copy of the License at
 *
 *  http://www.confluent.io/confluent-community-license
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OF ANY KIND, either express or implied.  See the License for the
 *  specific language governing permissions and limitations under the License.
 *
 *  @作   者： 黄开晖 (117227773@qq.com)
 *  @日   期:  2022年3月13日
 */
package com.massyframework.beanskin.service;

import java.util.List;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Stream;

/**
 * 多个输出服务构成的组
 * @author huangkh
 *
 */
public interface ExportServiceDescriptors {
	
	/**
	 * 判断是否包含{@code desc}成员
	 * @param desc {@link ExportServiceDescriptor}
	 * @return {@link boolean}, 返回{@code true}表示包含，否则返回{@code false}
	 */
	boolean containsExportService(ExportServiceDescriptor desc);

	/**
	 * 满足{@code filter}条件的首个输出服务
	 * @param filter {@link Predicate},过滤条件
	 * @return {@link ExportServiceDescriptor},可能返回null.
	 */
	ExportServiceDescriptor findByFilter(Predicate<ExportServiceDescriptor> filter);
	
	/**
	 * 所有输出服务定义 
	 * @return {@link List}
	 */
	List<ExportServiceDescriptor> getItems();
	
	/**
	 * 满足{@link filter}条件的所有输出服务定义
	 * @param filter {@link Predicate}
	 * @return {@link List}
	 */
	List<ExportServiceDescriptor> getItemsByFilter(Predicate<ExportServiceDescriptor> filter);
	
	/**
	 * 经过{@code action}处理后的所有输出服务定义
	 * @param action {@link Function},流处理逻辑
	 * @return {@link List}
	 */
	List<ExportServiceDescriptor> getItemsByAction(Function<Stream<ExportServiceDescriptor>, Stream<ExportServiceDescriptor>> action);
	
	/**
	 * 成员数量
	 * @return {@link int}
	 */
	int size();
}
